* Table 3
local table "Table3"
use "./data/publications.dta", clear
createvarspub
keep if year>1999
qui putexcel set "./tables/tables.xlsx", sheet("`table'") modify
bys article: keep if _n==1
count
local tot=r(N)
di "Total number of articles -> `tot'"
count if tnational
local tport=r(N)
di "Total number of articles with portuguese aff -> `tport'"
count if tpfaonly
di "Total number of articles by port w for aff -> `tpormain'"
collapse (sum) tnational tpfaonly tu* tis* tbp (count) total=article, by(journal)
decode journal, gen(journalname)
splitstr dum journalname
gsort -total journalname
gen shpp=tnational/total
gen shpf=tpfaonly/total
list journalname total tnational tpfaonly sh* in 1/30
* output to excel
mkmat total in 1/30, mat(P1)
mkmat sh* in 1/30, mat(P2)
qui putexcel A1=("Journal")
forval i=1/30 {
local j=`i'+1
local jn=journalname[`i']
qui putexcel A`j'="`jn'"
}
qui putexcel B1=("All")
qui putexcel C1=("Port Inst")
qui putexcel D1=("Port For")
qui putexcel B2=matrix(P1)
qui putexcel C2=matrix(P2), nformat(##.0%)
